package com.zjy.service.impl;

import com.zjy.bean.GoodsPhoto;
import com.zjy.dao.GoodsPhotoMapper;
import com.zjy.service.GoodsPhotoService;
import com.zjy.utils.UUIDUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * Created by Administrator on 2019/5/15.
 */
@Service
public class GoodsPhotoServiceImpl implements GoodsPhotoService{
    @Resource
    private GoodsPhotoMapper goodsPhotoMapper;

    @Override
    public GoodsPhoto selectByGoodsId(String goodsId) {
        return goodsPhotoMapper.selectByGoodsId(goodsId);
    }

    @Override
    public void addGoodsPhoto(GoodsPhoto goodsPhoto) {
        goodsPhoto.setId(UUIDUtils.getUUID());
        goodsPhotoMapper.insertSelective(goodsPhoto);
    }

    @Override
    public int updateGoodsPhotoById(GoodsPhoto goodsPhoto) {
        return goodsPhotoMapper.updateByPrimaryKeySelective(goodsPhoto);
    }
}
